package com.cgly.medical.controller;

import com.cgly.medical.service.StaService;
import com.cgly.medical.util.Msg;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/stas")
@CrossOrigin
public class StaController {

    @Resource
    private StaService staService;

    //统计某一天的药品订单数,登录人数，就诊人数，生成统计数据
    @PostMapping("countNum/{day}")
    public Msg drugOrderCount(@PathVariable String day) {
        Msg msg = staService.countNum(day);
        return msg;
    }

    //图表显示，返回两部分数据，日期json数组，数量json数组
    @GetMapping("showDate/{type}/{begin}/{end}")
    public Msg showDate(@PathVariable String type,@PathVariable String begin,@PathVariable String end ){
        Map<String,Object> map=staService.showDate(type,begin,end);
        return Msg.success().data("map",map);
    }

}
